<template>
  <van-pull-refresh v-model="refreshing" style="min-height: 300px" @refresh="getList(1)">
    <template v-if="listData.length">
      <van-list
        v-model="loading"
        :finished="finished"
        :immediate-check="false"
        :error.sync="error"
        error-text="请求失败，点击重新加载"
        finished-text="没有更多了~"
        @load="getList"
      >
        <gb-card
          border
          shadow
          :remind="item.isTimeOut === '2'"
          :color="eventStatusColor[item.eventStatus]"
          class="list-item"
          v-for="(item, key) in listData"
          :key="key"
          labelType="bubble"
          :labelText="item.eventStatusName"
          :affix-icon="
            item.isSupervising === '1' ? require('@/assets/images/event/basic/icon_affix_supervise.png') : ''
          "
          @click="$router.push(`/event/detail?eventCode=${item.eventCode}`)"
        >
          <p class="gb-card-info">
            <span class="gb-card-info__label">事件标题</span>
            <span class="gb-card-info__value van-multi-ellipsis--l2">{{ item.eventName }}</span>
          </p>
          <p class="gb-card-info">
            <span class="gb-card-info__label">事件来源</span>
            <span class="gb-card-info__value blue van-multi-ellipsis--l2">{{ item.eventOriginName }}</span>
          </p>
          <p class="gb-card-info" v-if="item.eventTypeName">
            <span class="gb-card-info__label">事件类型</span>
            <span class="gb-card-info__value">
              <van-tag size="medium" color="rgba(59, 153, 218, 0.2)" text-color="#3B99DA">
                {{ item.eventTypeName }}
              </van-tag>
            </span>
          </p>
          <p class="gb-card-info" v-if="item.hisList.length">
            <span class="gb-card-info__label">
              最新流转
              <br />
              状态
            </span>
            <span class="gb-card-info__value van-multi-ellipsis--l2">
              {{ item.hisList[item.hisList.length - 1].activityName }}
            </span>
          </p>
          <p class="gb-card-info" v-if="item.superviseResult">
            <span class="gb-card-info__label">督办意见</span>
            <span class="gb-card-info__value van-multi-ellipsis--l2">{{ item.superviseResult }}</span>
          </p>
          <p class="gb-card-info" v-if="item.delayedResult">
            <span class="gb-card-info__label">延时审批</span>
            <span class="gb-card-info__value van-multi-ellipsis--l2">{{ item.delayedResult }}</span>
          </p>
          <p class="gb-card-info">
            <span class="gb-card-info__label">事件点位</span>
            <span class="gb-card-info__value van-multi-ellipsis--l2">{{ item.eventLocation }}</span>
          </p>
        </gb-card>
      </van-list>
    </template>
    <template v-else>
      <van-empty
        :image="require('@/assets/images/basic/pic_no_content.png')"
        description="暂无内容~"
        style="height: 200px"
      />
    </template>
  </van-pull-refresh>
</template>
<script>
import Event from '@/api/event'
import List from '@/mixins/list'
export default {
  mixins: [List],
  props: {
    searchForm: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      api: Event.Manage,
      eventStatusColor: {
        // 待处置
        7: '#E28556',
        // 处置中
        3: '#E2AB56',
        // 已处置
        4: '#3CBDD0',
        // 已退回
        6: '#E25656'
      }
    }
  },
  created() {
    this.getList()
  }
}
</script>
<style scoped lang="less">
@import '~@/assets/style/list.less';
</style>
